using Infrastructure;
using Microsoft.AspNetCore.Mvc;
using ZR.Admin.WebApi.Filters;
using ZR.Model;
using ZR.Model.System.Dto;
using ZR.ServiceCore.Services.IService;

namespace ZR.Admin.WebApi.Controllers.System
{
    /// <summary>
    /// 表数据管理
    /// </summary>
    [Verify]
    [Route("system/tableMetadata")]
    [ApiExplorerSettings(GroupName = "sys")]
    public class TableMetadataController : BaseController
    {
        private readonly ITableMetadataService _tableMetadataService;

        public TableMetadataController(ITableMetadataService tableMetadataService)
        {
            _tableMetadataService = tableMetadataService;
        }

        /// <summary>
        /// 表数据列表
        /// </summary>
        [HttpPost("list")]
        public IActionResult List([FromBody] TableMetadataQueryDto query)
        {
            var pager = new PagerInfo
            {
                PageNum = query.PageNum,
                PageSize = query.PageSize
            };

            var result = _tableMetadataService.GetTableMetadataList(query, pager);
            return SUCCESS(result);
        }
    }
}

